//
//  MemberfindIntegralListCell.m
//  P001
//
//  Created by panquanReabam.com on 16/6/3.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "MemberfindIntegralListCell.h"
@interface MemberfindIntegralListCell()
@property(nonatomic,strong)UILabel *integral;
@property(nonatomic,strong)UILabel *createDate;
@property(nonatomic,strong)UILabel *memo;
@property(nonatomic,strong)UILabel *type;

@property(nonatomic,strong)UILabel *lineLabel;
@end
@implementation MemberfindIntegralListCell
{
    NSMutableArray*memberIdArrays;
    
}

- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        memberIdArrays=[[NSMutableArray alloc]init];
        [self createView];
        
        [self setViewAutoLayout];
    }
    
    return self;
    
}
-(void)createView
{
    self.integral=[[UILabel alloc] init];
    self.integral.font= [UIFont systemFontOfSize:18];
    [self addSubview:self.integral];
    self.createDate=[[UILabel alloc] init];
    self.createDate.font= [UIFont systemFontOfSize:13];
    self.createDate.textColor=zhonghuiColor;
    [self addSubview:self.createDate];
    self.memo=[[UILabel alloc] init];
    self.memo.font= [UIFont systemFontOfSize:14];
    self.memo.textColor=shenhuiColor;
    [self addSubview:self.memo];
    self.type=[[UILabel alloc] init];
    self.type.font= [UIFont systemFontOfSize:10];
    self.type.textColor=[UIColor whiteColor];
    [self addSubview:self.type];
        self.lineLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, 90-0.4, ScreenWidth-20, 0.4)];
    [self.lineLabel setBackgroundColor:[UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:238.0f/255.0f alpha:1.0f]];
    self.lineLabel.textColor=[UIColor clearColor];
    [self addSubview:self.lineLabel];
    
}
-(void)setModel:(MemberfindIntegralModel *)model
{
    NSRange range={0,1};
    NSString* string =[[NSString stringWithFormat:@"%@", model.integral] substringWithRange:range];
    
        if ([string isEqualToString:@"-"]) {
          self.integral.textColor=hongseColor;
              self.integral.text=[NSString stringWithFormat:@"%@",  model.integral];
        }else{
          self.integral.textColor=qianheiColor;
              self.integral.text=[NSString stringWithFormat:@"+%@",  model.integral];
        }
        self.type.backgroundColor=luseColor;
        self.type.text=[NSString stringWithFormat:@"%@",  model.typeName];
  
        self.memo.text=[NSString stringWithFormat:@"%@",  model.memo];
        self.createDate.text=[NSString stringWithFormat:@"%@", model.createDate];
//        self.lineLabel.text=[NSString stringWithFormat:@"%@",model.integral];
}
-(void)setViewAutoLayout
{
    
    [self.createDate mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@13);
        make.top.equalTo(self.mas_top).with.offset(15);
    }];
    [self.memo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15);
        
        make.height.equalTo(@14);
        
        make.top.equalTo(self.createDate.mas_bottom).with.offset(7.5);
    }];

    [self.type mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15);
        
        make.height.equalTo(@13);
        
        make.top.equalTo(self.memo.mas_bottom).with.offset(5);
    }];
    
    [self.integral mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15);
        make.height.equalTo(@14);
        
        make.centerY.equalTo(self.memo.mas_centerY) ;
        
    }];
    
//    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_left).with.offset(10);
//        make.right.equalTo(self.mas_right).with.offset(-10);
//        
//        make.height.equalTo(@0.5);
//        
//        make.top.equalTo(@90).with.offset(0);
//    }];
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
